package com.flowerSystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.flowerSystem.entity.Shoppingcart;
import com.flowerSystem.mapper.ShoppingCartMapper;
import com.flowerSystem.pojo.ShoppingcartPojo;
import com.flowerSystem.service.ShoppingcartService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 鲜花遇上牛战士
 * @since 2023-08-28
 */
@Service
public class ShoppingcartServiceImpl extends ServiceImpl<ShoppingCartMapper, Shoppingcart> implements ShoppingcartService {

    @Resource
    private ShoppingCartMapper shoppingCartMapper;
    @Override
    public int plusOrderCountById(int id) {
        return shoppingCartMapper.plusOrderCountById(id);
    }

    @Override
    public int reduceOrderCountById(int id) {
        return shoppingCartMapper.reduceOrderCountById(id);
    }

    @Override
    public Shoppingcart getOrderCountById(int id) {
        return shoppingCartMapper.getOrderCountById(id);
    }

    @Override
    public List<ShoppingcartPojo> getShopOrderAll(int userId) {
        return shoppingCartMapper.getShopOrderAll(userId);
    }

    @Override
    public int delShopping(int id,int userId) {
        return shoppingCartMapper.delete(new QueryWrapper<Shoppingcart>().eq("id",id).eq("user_id",userId));
    }

}
